home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 5.0 KB | 135 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // USkeletonApplication.cp
- // Copyright © 1991-96 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- #ifndef __UAPPLICATIONSKELETON__
- #include "UApplicationSkeleton.h"
- #endif
-
- #ifndef __UDOCUMENTSKELETON__
- #include "UDocumentSkeleton.h"
- #endif
-
- #ifndef __UVIEWSKELETON__
- #include "UViewSkeleton.h"
- #endif
-
- #ifndef __UMENUMGR__
- #include "UMenuMgr.h"
- #endif
-
- //----------------------------------------------------------------------------------------
- // Constants:
-
- const OSType kSignature = 'SS01'; // Application signature
-
- const CommandNumber cCommandHandledByApplication = 400;
-
- //========================================================================================
- // CLASS TApplicationSkeleton
- //========================================================================================
- #undef Inherited
- #define Inherited TApplication
-
- #pragma segment AInit
- MA_DEFINE_CLASS_M1(TApplicationSkeleton, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TApplicationSkeleton constructor
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- TApplicationSkeleton::TApplicationSkeleton()
- {
- // Initialize fields to safe values here
- }
-
- //----------------------------------------------------------------------------------------
- // TApplicationSkeleton destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TApplicationSkeleton::~TApplicationSkeleton()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TApplicationSkeleton::IApplicationSkeleton:
- //----------------------------------------------------------------------------------------
- #pragma segment AInit
-
- void TApplicationSkeleton::IApplicationSkeleton()
- {
- this->IApplication(kFileType,kSignature);
- } // TApplicationSkeleton::IApplicationSkeleton
-
- //----------------------------------------------------------------------------------------
- // TApplicationSkeleton::DoMakeDocument: This method is overridden to return a document
- // object of the appropriate class for this application. MacApp calls this method when the
- // user chooose New or Open from the File menu. For applications which hande multiple
- // document types, the command number can be used to discriminate between different user
- // requests. The file object represents the file chosen by the user in the Standard File
- // dialog.
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- TDocument* TApplicationSkeleton::DoMakeDocument(CommandNumber /* itsCommandNumber */,
- TFile* itsFile) // Override
- {
- TDocumentSkeleton* aDocument = new TDocumentSkeleton;
-
- aDocument->IDocumentSkeleton(itsFile,kSignature);
- return aDocument;
- } // TApplicationSkeleton::DoMakeDocument
-
- //----------------------------------------------------------------------------------------
- // TApplicationSkeleton::DoMenuCommand: This method is overridden to handle menu items
- // which are enabled when this object is in the target chain. The application object is
- // always in the target chain.
- //
- // The inherited method is called so that MacApp can handle application-level menu items
- // like the "About " menu item in the Apple menu.
- //----------------------------------------------------------------------------------------
- #pragma segment ASelCommand
-
- void TApplicationSkeleton::DoMenuCommand(CommandNumber aCommandNumber) // Override
- {
- switch (aCommandNumber)
- {
- case cCommandHandledByApplication :
- SysBeep(2);
- break;
- default:
- Inherited::DoMenuCommand(aCommandNumber);
- break;
- }
- } // TApplicationSkeleton::DoMenuCommand
-
- //----------------------------------------------------------------------------------------
- // TApplicationSkeleton::DoSetupMenus: This method is overridden to enable menu items
- // which should be enabled when this object is in the target chain. MacApp initially
- // disables all menu items, then lets the objects in the target chain enable those items
- // they handle.
- //
- // The application object is always in the target chain, so the About menu item in the
- // Apple menu and the item with command number cMenuHandledByApplication should be enabled
- // even if there are no open documents.
- //
- // The inherited method is called so that MacApp can enable application-level menu items
- // like the "About " menu item.
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TApplicationSkeleton::DoSetupMenus() // Override
- {
- Inherited::DoSetupMenus(); // Always call the inherited method first
-
- Enable(cCommandHandledByApplication,TRUE);
- } // TApplicationSkeleton::DoSetupMenus
-
- //----------------------------------------------------------------------------------------
- // End of UApplicationSkeleton.cp
-
- #pragma segment Inline
-